package com.crc.luojian.util;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * @program: luojian-springframework
 * @description:
 * @author: luojian58
 * @create: 2021-06-14 10:29
 */
public class DBUtil {

    private static volatile DBUtil instance = null;
    private DBUtil(){

    }
    //DCL 创建单例对象
    public static DBUtil getInstance(){
        if(instance == null){
            synchronized (DBUtil.class){
                if(instance == null) {
                    instance = new DBUtil();
                }
            }
        }
        return instance;

    }

    private static DBConnectionPool pool = new DBConnectionPool();

    public static Connection getConnection() {
        return pool.getConnection();
    }
}
